package com.gitee.huanminabc.fastboot.proxy;

import com.gitee.huanminabc.fastboot.common.Order;

import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.Callable;

/**
 * 代理拦截器接口
 * context 上下文
 *  interceptorType: 拦截器类型
 * @Author: huanmin
 * @Date: 2025/4/5 15:06
 * @Version: 1.0
 * @Description: 文件作用详细描述....
 */
public interface InterceptorHandle extends Order {
    //前置处理
    default void before(Object targetProxy , Class<?> realClass, Method method, Object[] args, Map<String,Object> context) {
        //默认实现
    }
    //后置处理
    default Object after(Object targetProxy, Class<?> realClass, Method method, Object[] args, Object result, Map<String,Object> context) {
        return result;
    }

    //异常处理
    default void error(Object targetProxy, Class<?> realClass, Method method, Object[] args, Exception e, Map<String,Object> context) {
        //默认实现
    }

    //最终处理  finally
    default void returnAfter(Object targetProxy, Class<?> realClass, Method method, Object[] args, Map<String,Object> context) {
        //默认实现
    }

    //环绕
    default Object around(Object targetProxy, Class<?> realClass, Method method, Object[] args, Callable<?> callable, Map<String,Object> context) throws Exception {
        return null;
    }


}
